package com.dpwgc.consumer.controller;

import com.dpwgc.consumer.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 消费者-负载均衡功能节点测试
 */
@CrossOrigin
@RequestMapping(value = "/Consumer")
@RestController
public class ConsumerController {

    @Value("${server.port}")
    private String port;

    @Autowired
    DiscoveryClient discoveryClient;


    @RequestMapping(value = "index")
    public ResultUtil<Object> index(){
        ResultUtil<Object> resultUtil = new ResultUtil<>();

        resultUtil.setCode(200);
        resultUtil.setMsg("消费者运行正常");
        resultUtil.setData("端口："+port);
        return resultUtil;
    }
}
